<?php
namespace app\api\controller;
use app\BaseController;
use think\facade\Db;
use qiniu\Qn;
use date\Datetips;
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Headers: x-token, x-uid, Origin, X-Requested-With, Content-Type, Accept");
header('Access-Control-Allow-Methods: GET, POST, PUT, OPATION');
header('content-type:application/json;charset=utf8');
class Login extends BaseController
{
    /*定义一个初始数组*/
    protected $info = array(
        'code'=>200,
        'msg'=>'提示',
        'total'=>0,//数据数量
        'data'=>[]
    );

    //写入操作日志
    protected function logData($action='',$admin_id=0){
        $pt['time'] = time();
        $pt['admin_id'] =  $admin_id;
        $pt['action'] =  trim($action);
        Db::table('an_admin_log')->insert($pt);
    }

    public function isNot($code=200){
        $this->info['code'] = intval($code);
        if($code == 10001){
            $this->info['msg'] = '请求验证失败';
        }
        if($code == 10002){
            $this->info['msg'] = '请登录后再操作';
        }
        if($code == 10003){
            $this->info['msg'] = '账号不存在';
        }
        return json($this->info);
    }
}
